package cc.laop.service;

import cc.laop.entity.Role;
import cc.laop.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service
public class URService {

    @Autowired
    private UserService userService;

    @Autowired
    private RoleService roleService;

    @Transactional(propagation = Propagation.REQUIRED)
    public void insert(User user, Role role) {

        roleService.insert(role);

        userService.insert(user);

    }

}
